-if @topic.new_record?
  -url = forum_topics_path(@forum)
  -object = @topic
-else
  -url = forum_topic_path(@forum, @topic)
  -object = [@forum, @topic]

= bootstrap_form_for object, :url => url, :layout => :horizontal do |f|
  = f.text_field :title

  - if admin? or current_user.moderator_of?(@topic.forum)
    = f.form_group :options_group do
      = f.check_box :sticky
      = f.check_box :locked
  = f.text_field :tag_list, :autocomplete => "off", :label => :tags.l, :help => :optional_keywords_describing_this_topic_separated_by_commas.l

  -content_for :end_javascript do
    = tag_auto_complete_field 'topic_tag_list', {:url => { :controller => "tags", :action => 'auto_complete_for_tag_name'}, :tokens => [','] }

  - if @topic.new_record?
    = f.fields_for :sb_posts do |x|
      = x.text_area :body, :rows => 12, :class => 'rich_text_editor', :label => :body_text.l, :required => false

  - if admin? and not @topic.new_record?
    = f.select :forum_id, Forum.order("position ASC").map {|x| [x.name, x.id] }, :label => :forum.l

  = f.form_group :submit_group do
    = f.primary :save.l
